A multi-media processor may include a graphics processing unit (GPU), a video processing unit, a still-image processing unit, and an audio processing unit. For example, a GPU is a dedicated graphics rendering device utilized to manipulate and display computerized graphics on a display. GPUs are built with a highly-parallel structure that provides more efficient processing than typical, general-purpose central processing units (CPUs) for a range of complex graphic-related algorithms. For example, the complex algorithms may correspond to representations of three-dimensional computerized graphics. A GPU may implement a number of so-called “primitive” graphics operations, such as operations that form points, lines, and triangles, to create complex, three-dimensional images on a display more quickly than drawing the images directly to the display with a CPU. GPUs may be used in a wide variety of applications, and are very common in graphic-intensive applications, such as video gaming.
Vertex shading and pixel shading are often utilized to determine final surface properties of a computerized image, such as light absorption and diffusion, texture mapping, light relation and refraction, shadowing, surface displacement, and post-processing effects. GPUs typically include a number of pipeline stages such as one or more shader stages, setup stages, rasterizer stages, and interpolation stages.
A vertex shader, for example, is typically applied to image data, such as the geometry for an image, and the vertex shader generates vertex coordinates and attributes of vertices within the image data. Vertex attributes include color, normal, and texture coordinates associated with a vertex. One or more primitive setup and rejection modules may form primitive shapes such as points, lines, or triangles, and may reject hidden or invisible primitive shapes based on the vertices within the image data. An attribute setup module computes gradients of attributes within the primitive shapes for the image data. Once the attribute gradient values are computed, primitive shapes for the image data may be converted into pixels, and pixel rejection may be performed with respect to hidden primitive shapes.
An attribute interpolator then interpolates the attributes over pixels within the primitive shapes for the image data based on the attribute gradient values, and sends the interpolated attribute values to the fragment shader for pixel rendering. Results of the fragment shader are output to a post-processing block and a frame buffer for presentation of the processed image on the display. In some cases, this process may be performed using a vertex shader and a fragment shader arranged as successive stages of the GPU pipeline. In other cases, this process may be performed using a multi-shader that is capable of operating as both a vertex shader and a fragment shader coupled to the GPU pipeline.